package com.sjgs.gis.service.dto;

import java.io.Serializable;
import java.util.Objects;

import com.sjgs.gis.web.rest.NodePluginResource;
import io.github.jhipster.service.Criteria;
import com.sjgs.gis.domain.enumeration.PluginStatus;
import io.github.jhipster.service.filter.Filter;
import io.github.jhipster.service.filter.LongFilter;
import io.github.jhipster.service.filter.StringFilter;
import io.github.jhipster.service.filter.InstantFilter;

/**
 * Criteria class for the {@link com.sjgs.gis.domain.NodePlugin} entity. This class is used
 * in {@link NodePluginResource} to receive all the possible filtering options from
 * the Http GET request parameters.
 * For example the following could be a valid request:
 * {@code /node-plugins?id.greaterThan=5&attr1.contains=something&attr2.specified=false}
 * As Spring is unable to properly convert the types, unless specific {@link Filter} class are used, we need to use
 * fix type specific filters.
 */
public class NodePluginCriteria implements Serializable, Criteria {
    /**
     * Class for filtering PluginStatus
     */
    public static class PluginStatusFilter extends Filter<PluginStatus> {

        public PluginStatusFilter() {
        }

        public PluginStatusFilter(PluginStatusFilter filter) {
            super(filter);
        }

        @Override
        public PluginStatusFilter copy() {
            return new PluginStatusFilter(this);
        }

    }

    private static final long serialVersionUID = 1L;

    private LongFilter id;

    private LongFilter pluginId;

    private StringFilter data;

    private StringFilter sql;

    private InstantFilter installTime;

    private PluginStatusFilter status;

    private LongFilter nodeId;

    public NodePluginCriteria() {
    }

    public NodePluginCriteria(NodePluginCriteria other) {
        this.id = other.id == null ? null : other.id.copy();
        this.pluginId = other.pluginId == null ? null : other.pluginId.copy();
        this.data = other.data == null ? null : other.data.copy();
        this.sql = other.sql == null ? null : other.sql.copy();
        this.installTime = other.installTime == null ? null : other.installTime.copy();
        this.status = other.status == null ? null : other.status.copy();
        this.nodeId = other.nodeId == null ? null : other.nodeId.copy();
    }

    @Override
    public NodePluginCriteria copy() {
        return new NodePluginCriteria(this);
    }

    public LongFilter getId() {
        return id;
    }

    public void setId(LongFilter id) {
        this.id = id;
    }

    public LongFilter getPluginId() {
        return pluginId;
    }

    public void setPluginId(LongFilter pluginId) {
        this.pluginId = pluginId;
    }

    public StringFilter getData() {
        return data;
    }

    public void setData(StringFilter data) {
        this.data = data;
    }

    public StringFilter getSql() {
        return sql;
    }

    public void setSql(StringFilter sql) {
        this.sql = sql;
    }

    public InstantFilter getInstallTime() {
        return installTime;
    }

    public void setInstallTime(InstantFilter installTime) {
        this.installTime = installTime;
    }

    public PluginStatusFilter getStatus() {
        return status;
    }

    public void setStatus(PluginStatusFilter status) {
        this.status = status;
    }

    public LongFilter getNodeId() {
        return nodeId;
    }

    public void setNodeId(LongFilter nodeId) {
        this.nodeId = nodeId;
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        final NodePluginCriteria that = (NodePluginCriteria) o;
        return
            Objects.equals(id, that.id) &&
            Objects.equals(pluginId, that.pluginId) &&
            Objects.equals(data, that.data) &&
            Objects.equals(sql, that.sql) &&
            Objects.equals(installTime, that.installTime) &&
            Objects.equals(status, that.status) &&
            Objects.equals(nodeId, that.nodeId);
    }

    @Override
    public int hashCode() {
        return Objects.hash(
        id,
        pluginId,
        data,
        sql,
        installTime,
        status,
        nodeId
        );
    }

    // prettier-ignore
    @Override
    public String toString() {
        return "NodePluginCriteria{" +
                (id != null ? "id=" + id + ", " : "") +
                (pluginId != null ? "pluginId=" + pluginId + ", " : "") +
                (data != null ? "data=" + data + ", " : "") +
                (sql != null ? "sql=" + sql + ", " : "") +
                (installTime != null ? "installTime=" + installTime + ", " : "") +
                (status != null ? "status=" + status + ", " : "") +
                (nodeId != null ? "nodeId=" + nodeId + ", " : "") +
            "}";
    }

}
